package org.aurora.four.atomic_7;

import java.util.concurrent.atomic.LongAccumulator;
import java.util.function.LongBinaryOperator;

/**
 * @author : Aurora
 * @date : 2024/3/26 13:49
 * @description LongAccumulator类原理探究
 */
public class LongAccumulatorAnalysis {
    public static void main(String[] args) {
        //longAdder相当于下述方式调用LongAccumulator
        LongAccumulator longAccumulator = new LongAccumulator(new LongBinaryOperator() {
            @Override
            public long applyAsLong(long left, long right) {
                return left + right;
            }
        }, 0);
    }
}
